package com.transportation.app

import android.content.Context
import android.util.Log
import android.widget.Toast
import androidx.lifecycle.MutableLiveData
import com.transportation.app.bean.AppInit
import com.transportation.app.bean.BaseViewModel
import com.transportation.app.net.RetrofitManager
import com.transportation.app.net.RetrofitRxSubscribe
import com.transportation.app.net.ServerApi

class BusViewModel : BaseViewModel() {

    var appInitLiveData = MutableLiveData<AppInit>()

    //当前行程数据
    fun initApp(serialNumber: String) {
        addDisposable(RetrofitManager.api<ServerApi>().serialNumber(serialNumber),
            object : RetrofitRxSubscribe<AppInit?>() {
                override fun onSuccess(t: AppInit?) {
                    appInitLiveData.value = t
                }

                override fun onFailed(code: Int, msg: String?) {
                    super.onFailed(code, msg)
                    appInitLiveData.value = null
                }
            })
    }
}